﻿package com.victim.snake.user
{
	import flash.net.Socket;
	import flash.display.MovieClip;
	import flash.display.Stage;
	import com.victim.snake.player.Player;
	import com.victim.snake.graphics.MainSprite;
	import com.victim.snake.graphics.RoomSprite;
	import com.victim.snake.graphics.LandSprite;
	import com.victim.snake.graphics.CreateRoomSprite;
	import com.victim.snake.graphics.ChatSprite;
	import com.victim.snake.graphics.ErrorSprite;
	import com.victim.snake.graphics.PlaySprite;
	import com.victim.snake.snake.Snake;
	import com.victim.snake.room.Room;

	
	//用户类，包含当前用户资源
	public class User
	{
		static private var player:Player=new Player();		//用户信息
		static private var socket:Socket=null;	//用户连接
		static private var stage:Stage=null;	//舞台
		static private var room:Room=null;;	//当前房间
		static private var snake:Snake=null;	//玩家的蛇
		
		static private var mainSprite:MainSprite=null;			//主窗口
		static private var roomSprite:RoomSprite=null;	//房间窗口
		static private var landSprite:LandSprite=null;	//登陆框
		static private var createRoomSprite:CreateRoomSprite=null;	//创建房间对话框
		static private var errorSprite:ErrorSprite=null;	//错误消息框
		static private var playSprite:PlaySprite=null;	//游戏窗口		
		static private var chatSprite:ChatSprite=null;	//聊天窗口
		
		/*
		static private var roomList:Array=null;	//房间列表
		static public function getRoomList():Array{
			return User.roomList;
		}		
		
		static public function setRoomList(roomList:Array):void{
			User.roomList=roomList;
		}		
		*/
		
		static public function getSnake():Snake{
			return User.snake;
		}		

		static public function setSnake(snake:Snake):void{
			User.snake=snake;
		}
		
		static public function getPlaySprite():PlaySprite{
			return User.playSprite;
		}		

		static public function setPlaySprite(playSprite:PlaySprite):void{
			User.playSprite=playSprite;
		}
		
		static public function getErrorSprite():ErrorSprite{
			return User.errorSprite;
		}		

		static public function setErrorSprite(errorSprite:ErrorSprite):void{
			User.errorSprite=errorSprite;
		}

		static public function getLandSprite():LandSprite{
			return User.landSprite;
		}		

		static public function setLandSprite(landSprite:LandSprite):void{
			User.landSprite=landSprite;
		}

		static public function getRoomSprite():RoomSprite{
			if(User.roomSprite==null){
				User.setRoomSprite(new RoomSprite());
			}
			return User.roomSprite;
		}
		
		static public function hasRoomSprite():Boolean{
			return User.roomSprite!==null?true:false;
		}

		static public function setRoomSprite(roomSprite:RoomSprite):void{
			User.roomSprite=roomSprite;
		}
		
		static public function getChatSprite():ChatSprite{
			return User.chatSprite;
		}		

		static public function setChatSprite(chatSprite:ChatSprite):void{
			User.chatSprite=chatSprite;
		}
		
		static public function getRoom():Room{
			return User.room;
		}		

		static public function setRoom(room:Room):void{
			User.room=room;
		}
		
		static public function getPlayer():Player{
			return User.player;
		}
		
		static public function setPlayer(player:Player):void{
			User.player=player;
		}
		

		
		
		static public function getMainSprite():MainSprite{
			return User.mainSprite;
		}
		
		static public function setMainSprite(mainSprite:MainSprite):void{
			User.mainSprite=mainSprite;
		}
		
		
		static public function getStage():Stage{
			return User.stage;
		}		
		
		static public function setStage(stage:Stage):void{
			User.stage=stage;
		}
		
		static public function getSocket():Socket{
			return User.socket;
		}
		
		static public function setSocket(socket:Socket):void{
			User.socket=socket;
		}
	}

}